package com.fanshilz.flower2025.apps.wechatminiapp.satoken;

import cn.hutool.core.util.ObjUtil;
import com.fanshilz.flower2025.business.flower.wechatUser.entity.WechatUser;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@AutoMapper(target = WechatUser.class, convertGenerate = false)
public class WechatCurrentUser implements Serializable {

    private Long userId;

    private String userUuid;

    private String userOpenid;

    private String userUnionid;

    private String userNickName;

    private String userMobile;

    private String userHeadImgUrl;

    public void setUserHeadImgUrl(String userHeadImgUrl) {
        if (ObjUtil.isNotNull(userHeadImgUrl)) {
            if (userHeadImgUrl.startsWith("http")) {
                this.userHeadImgUrl = userHeadImgUrl;
            } else {
                this.userHeadImgUrl = "https://file.fanshilz.com/" + userHeadImgUrl;
            }
        }
    }

    private String sessionKey;

    private Integer userCheckStatus;

    private String identityRealName;

    private Integer identityTypeValue;

    private String identityTypeLabel;

    private String identityCompanyName;

}
